﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using GameEngine.Clients.Silverlight.View.Components;
using GameEngine.View.Components;

namespace MySettlers.View.Components
{
    public partial class MyLevelUC : UserControl, ISilverlightLevelView, IMenuView<string>
    {
        public event OnButtonClickHandler<string> OnExternalActionButtonClick;

        public MyLevelUC()
        {
            InitializeComponent();
        }

        public void SetWorldViews(List<IWorldView<int, FrameworkElement>> worlds)
        {
            worldContainer.Children.Clear();
            if(worlds.Count>0)
            worldContainer.Children.Add(worlds[0] as UIElement);

        }

        public void SetMapView(IWorldView<int, FrameworkElement> view)
        {
            mapContainer.Children.Clear();
            mapContainer.Children.Add(view as UIElement);
        }

        public void SetMenuView(UIElement view)
        {
            menuContainer.Children.Clear();
            menuContainer.Children.Add(view);
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;
            if (OnExternalActionButtonClick != null)
                OnExternalActionButtonClick((string)button.Tag);
        }

    }
}
